package com.ag.oa.netty;


import com.ag.oa.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Component;

/**
 * 初始化运行，Netty服务
 */
//@Component
//@EnableAsync
public class NettyCommandInit implements CommandLineRunner {

    @Value("${server.ssl.key-store}")
    private String sslKeyStore;

    @Value("${server.ssl.key-password}")
    private String sslKeyPassword;

    @Value("${netty.port}")
    private Integer nettyPort;

    @Value("${netty.origin}")
    private String nettyOrigin;

    @Autowired
    private RedisUtils redisUtils;

    @Async
    @Override
    public void run(String... args) throws Exception {
//        try {
//            System.out.println("nettyServer starting ...");
//            new NettyServer(sslKeyStore, sslKeyPassword, nettyPort, nettyOrigin, redisUtils).start();
//        } catch (Exception e) {
//            System.out.println("NettyServerError:" + e.getMessage());
//        }
    }
}
